struct ListNode *detectCycle(struct ListNode *head)
{
struct ListNode*fast=head;
struct ListNode* slow=head;
	while(fast&&fast->next)
	{
	  fast=fast->next->next;
	  slow=slow->next;
		if(fast==slow)
		{
		  struct ListNode* meet=fast;
		     while(meet!=head)
			{
			meet=meet->next;
			head=head->next;
			}
		      return meet;
		}
	}
        return NULL;
}
